<?php

/**
  * This plugin lets you set the default search fields for the search box.
  * RC by default only selects the subject. Use this plugin to add other
  * fields to the default set. 
  * 
  * Configure this plugin in config.inc.php by copying config.inc.php.dist 
  * and adding your preferred fields. 
  *
  * @version 1.0
  * @author Cor Bosman
  */

class searchbox extends rcube_plugin 
{
  function init()
  {
    $this->add_hook('login_after', array($this, 'set_searchbox'));
  }

  function set_searchbox($args)
  { 
    $this->load_config('config.inc.php.dist');
    $this->load_config('config.inc.php');
    
    $searchbox_checked = rcmail::get_instance()->config->get('searchbox_checked');
    
    foreach($searchbox_checked as $s) {
      $_SESSION['search_mods'][$s] = $s;
    }
  }
}
?>
